#pragma once
#include "../Behaviors/IUpdateRequired.h"
#include <OgreFrameListener.h>
#include <vector>

namespace VWD
{
	class ObjectUpdater:
		public Ogre::FrameListener
	{
	public:
		enum InvokeStyle
		{
			CallEveryOne,
			CallLastOne
		};
	private:		
		typedef std::vector<Behavior::IUpdateRequired*> UpdateVector;
		UpdateVector objectsBeUpdated;
		InvokeStyle updateStyle;				
	public:
		ObjectUpdater(void);
		~ObjectUpdater(void);

		VWD::ObjectUpdater::InvokeStyle GetUpdateStyle() const;
		void SetUpdateStyle(VWD::ObjectUpdater::InvokeStyle val);

		void AddObject(Behavior::IUpdateRequired* obj);

		void RemoveObject(Behavior::IUpdateRequired* obj);

		virtual bool frameStarted(const Ogre::FrameEvent& evt);
	};
}
